package chapter11;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-04-16 下午1:31
 */
public class App {
    public static void main(String[] args) {
        RoleService roleService = new RoleServiceImpl();
        Interceptor interceptor = new DefaultInterceptor();
        RoleService proxy = ProxyBeanFactory.getBean(roleService, interceptor);
        Role role = new Role(12, "test", "test note");
        System.out.println(" -------------- jdk-proxy ----------------");
        proxy.printRole(role);

        System.out.println(" --------------test afterThrowing----------------");
        proxy.printRole(null);

        System.out.println(" -------------- cg-lib ----------------");
        RoleService proxy2 = ProxyBeanFactory.getProxy(roleService, interceptor);
        proxy2.printRole(role);
        System.out.println(" --------------test afterThrowing----------------");
        proxy2.printRole(null);
    }
}
